package cn.iocoder.springboot.lab03.kafkademo.parser.http;

import cn.iocoder.springboot.lab03.kafkademo.utils.NamespaceUtil;
import cn.iocoder.springboot.lab03.kafkademo.utils.StringUtils;

import javax.servlet.http.HttpServletRequest;
import java.util.Properties;

/**
 * @Author：YH
 * @Description：
 * @Date:Created in 2023/12/30 16:52
 */
public class ConfigHttpResourceParser extends AbstractHttpResourceParser {
    @Override
    protected String getNamespaceId(HttpServletRequest request) {
        return NamespaceUtil.processNamespaceParameter(request.getParameter("tenant"));

    }

    @Override
    protected String getGroup(HttpServletRequest request) {
        String groupName = request.getParameter("group");
        return StringUtils.isBlank(groupName) ? StringUtils.EMPTY : groupName;
    }

    @Override
    protected String getResourceName(HttpServletRequest request) {
        String dataId = request.getParameter("dataId");
        return StringUtils.isBlank(dataId) ? StringUtils.EMPTY : dataId;
    }

    @Override
    protected Properties getProperties(HttpServletRequest request) {
        return new Properties();
    }
}
